-
Notifications
You must be signed in to change notification settings - Fork 27.4k
docs($rootScope.Scope): reinsert lost example #12167
Conversation
This doc example was lost long ago here angular@2845dd1 As it is now, it says 'here is a simple scope snippet...' but has a non-linking file link to the test doc. Doesn't make sense. This change simply puts back the example as it originally was.
// still old value, since watches have not been called yet | ||
expect(scope.greeting).toEqual(undefined); | ||
|
||
scope.$digest(); // fire all the watches |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you are at it, why not fix the double space after "all" :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Done.
removed extra white space at line 131 per code review suggestion
// still old value, since watches have not been called yet | ||
expect(scope.greeting).toEqual(undefined); | ||
|
||
scope.$digest(); // fire all the watches |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably change this to scope.$apply()
, since the use of $digest is basically not recommened anywhere in the docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't disagree regarding $digest not being recommended, but changing the example is not quite the scope of this request. This example was accidentally removed so I am just putting it back. This sample comes directly from the unit tests. All the examples on this page use $digest; none of them use $apply. The notes do indicate that $digest is not recommended, but similar notes regarding 'better practices' exist throughout the documentation. If you would like to file an issue to have the examples all changed to $apply, I think that would be great and hopefully someone can pick it up. Thanks!
I decided to not add the example, because it introduces concepts like $watch and $digest without actually explaining them. The examples for the methods do a better job at this. I also added a link to the guide. |
The removed line pointed to a removed example. Re-adding the example would have been of questionable value, as it introduced several concepts without context. It's therefore better to link to the guide, which provides a better introduction. Closes #12167
The removed line pointed to a removed example. Re-adding the example would have been of questionable value, as it introduced several concepts without context. It's therefore better to link to the guide, which provides a better introduction. Closes angular#12167
The removed line pointed to a removed example. Re-adding the example would have been of questionable value, as it introduced several concepts without context. It's therefore better to link to the guide, which provides a better introduction. Closes angular#12167
The removed line pointed to a removed example. Re-adding the example would have been of questionable value, as it introduced several concepts without context. It's therefore better to link to the guide, which provides a better introduction. Closes angular#12167
This doc example was lost long ago here 2845dd1
As it is now, it says 'here is a simple scope snippet...' but has a non-linking file link to the test doc. Doesn't make sense. This change simply puts back the example as it originally was.